package com.agent.gateway.config;

import org.springframework.core.convert.converter.Converter;
import org.springframework.security.authentication.AbstractAuthenticationToken;
import org.springframework.security.oauth2.jwt.Jwt;
import reactor.core.publisher.Mono;

/**
 * JWT转换器适配器
 */
public class JwtAuthenticationConverter
        implements Converter<Jwt, Mono<AbstractAuthenticationToken>> {

    private final org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter delegate = new org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter();

    @Override
    public Mono<AbstractAuthenticationToken> convert(Jwt jwt) {
        return Mono.just(delegate.convert(jwt));
    }
}